package com.citi.bond.service;

import com.citi.bond.mapper.UserMapper;
import com.citi.bond.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUserById(Integer id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public void setUserInfo(User user, Model model) {
        model.addAttribute("id",user.getId());
        model.addAttribute("name",user.getName());
        model.addAttribute("pass",user.getPass());
        model.addAttribute("createdAt",user.getCreatedAt());
        model.addAttribute("updatedAt",user.getUpdatedAt());
        model.addAttribute("status",user.getStatus());
    }
}
